- apt-get update && apt-get upgrade -y
- sudo apt-get -y install dos2unix
- sudo apt-get -y install zip unzip
- sudo apt install nano
- sudo apt install bash-completion
- sudo apt-get -y install mlocate & sudo updatedb
-> In Nano: Use CTRL+K to delete the full line / CTRL-X to exit
Update "/etc/fail2ban/jail.conf" file (if you have [ssh] inside)
- apt-get -y install fail2ban
Force reload it with:
- [DEFAULT]
- ignoreip = 127.0.0.1/8 __YOUR_IP__
- bantime = 600
- maxretry = 5
Check which IP try and fail with:
- sudo systemctl restart fail2ban
- Secure shared memory
- awk '($(NF-1) = /Ban/){print $NF}' /var/log/fail2ban.log | sort | uniq -c | sort -n
Add or Edit (not remove !) to have following lines:
- sudo nano /etc/fstab
- Harden network with sysctl settings
- tmpfs /dev/shm tmpfs defaults,noexec,nosuid 0 0
Add or Edit (not remove !) to have following lines:
- sudo nano /etc/sysctl.conf
Force reload it with:
- # IP Spoofing protection
- net.ipv4.conf.all.rp_filter = 1
- net.ipv4.conf.default.rp_filter = 1
- # Ignore ICMP broadcast requests
- net.ipv4.icmp_echo_ignore_broadcasts = 1
- # Disable source packet routing
- net.ipv4.conf.all.accept_source_route = 0
- net.ipv6.conf.all.accept_source_route = 0
- net.ipv4.conf.default.accept_source_route = 0
- net.ipv6.conf.default.accept_source_route = 0
- # Ignore send redirects
- net.ipv4.conf.all.send_redirects = 0
- net.ipv4.conf.default.send_redirects = 0
- # Block SYN attacks
- net.ipv4.tcp_syncookies = 1
- net.ipv4.tcp_max_syn_backlog = 2048
- net.ipv4.tcp_synack_retries = 2
- net.ipv4.tcp_syn_retries = 5
- # Log Martians
- net.ipv4.conf.all.log_martians = 1
- net.ipv4.icmp_ignore_bogus_error_responses = 1
- # Ignore ICMP redirects
- net.ipv4.conf.all.accept_redirects = 0
- net.ipv6.conf.all.accept_redirects = 0
- net.ipv4.conf.default.accept_redirects = 0
- net.ipv6.conf.default.accept_redirects = 0
- # Ignore Directed pings
- net.ipv4.icmp_echo_ignore_all = 1
- Prevent IP Spoofing
- sudo sysctl -p
Add or Edit (not remove !) to have following lines:
- sudo nano /etc/host.conf
- Harden PHP for security (if you have PHP installed)
- order bind,hosts
- multi on
- nospoof on
Add or Edit (not remove !) to have following lines:
- sudo nano /etc/php5/apache2/php.ini
- disable_functions = exec,system,shell_exec,passthru
- register_globals = Off
- expose_php = Off
- magic_quotes_gpc = On
- sudo apt -y install screenfetch
- sudo apt -y install toilet
- sudo apt -y install figlet
-> Upload "clean.sh" and "now.sh" (in /home/Files/) and do "chmod +x clean.sh now.sh" to give it execution right to be able to use it
-> Upload ".profile" (in /home/Files/) to be able to use it
Update "/home/now.sh" fileUpdate "~/.bashrc" file
- curl wttr.in/__YOUR_CITY__?0 --silent --max-time 3
Force reload it with:
- source /home/Files/.profile
- source ~/.bashrc
- Security
- apt-get install -y apache2 apache2-utils
- Modules
- ServerTokens Prod
- ServerSignature Off
Force reload it with:
- sudo rewrite
- Configuration
- service apache2 restart
- Index
- <Directory /home/canan>
- Options -Indexes
- AllowOverride All
- Require all granted
- </Directory>
- sudo apt-get install -y php libapache2-mod-php php-gd
-> If you want to test it, simply create a test file, then go on it, finally delete it
Update "/var/www/html/test.php" file (change by yours)Force reload it with:
- <?php
- phpinfo();
- ?>
Go to http://__YOUR_IP__/test.php
- service apache2 restart
Add or Edit (not remove !) to have following lines :
- crontab -e
- 10 5 * * MON apt-get -y autoclean; apt-get -y autoremove; apt-get -y clean;
- 20 5 * * MON dpkg --purge $(COLUMNS=200 dpkg -l | grep "^rc" | tr -s ' ' | cut -d ' ' -f 2);
- 30 5 * * MON rm -fr /var/log/syslog.*; rm -fr /var/log/auth.log.*;
- 40 5 * * MON apt-get -y update; apt-get -y upgrade
- apt-get update && apt-get upgrade -y
- sudo apt-get -y install dos2unix
- sudo apt-get -y install zip unzip
- sudo apt install nano
- sudo apt install bash-completion
- sudo apt-get -y install mlocate & sudo updatedb
-> Dans nano: utilisez CTRL+K pour supprimer la ligne complète / CTRL-X pour quitter
Mettre à jour le fichier "/etc/fail2ban/jail.conf" (si vous avez [ssh] à l'intérieur)
- apt-get -y install fail2ban
Forcer à le recharger avec :
- [DEFAULT]
- ignoreip = 127.0.0.1/8 __VOTRE_IP__
- bantime = 600
- maxretry = 5
Vérifiez quel IP essayer et échouer avec :
- sudo systemctl restart fail2ban
- Mémoire partagée sécurisée
- awk '($(NF-1) = /Ban/){print $NF}' /var/log/fail2ban.log | sort | uniq -c | sort -n
Ajouter ou modifier (ne pas supprimer !) pour avoir les lignes suivantes :
- sudo nano /etc/fstab
- Durcir le réseau avec les paramètres sysctl
- tmpfs /dev/shm tmpfs defaults,noexec,nosuid 0 0
Ajouter ou modifier (ne pas supprimer !) pour avoir les lignes suivantes :
- sudo nano /etc/sysctl.conf
Forcer à le recharger avec :
- # IP Spoofing protection
- net.ipv4.conf.all.rp_filter = 1
- net.ipv4.conf.default.rp_filter = 1
- # Ignore ICMP broadcast requests
- net.ipv4.icmp_echo_ignore_broadcasts = 1
- # Disable source packet routing
- net.ipv4.conf.all.accept_source_route = 0
- net.ipv6.conf.all.accept_source_route = 0
- net.ipv4.conf.default.accept_source_route = 0
- net.ipv6.conf.default.accept_source_route = 0
- # Ignore send redirects
- net.ipv4.conf.all.send_redirects = 0
- net.ipv4.conf.default.send_redirects = 0
- # Block SYN attacks
- net.ipv4.tcp_syncookies = 1
- net.ipv4.tcp_max_syn_backlog = 2048
- net.ipv4.tcp_synack_retries = 2
- net.ipv4.tcp_syn_retries = 5
- # Log Martians
- net.ipv4.conf.all.log_martians = 1
- net.ipv4.icmp_ignore_bogus_error_responses = 1
- # Ignore ICMP redirects
- net.ipv4.conf.all.accept_redirects = 0
- net.ipv6.conf.all.accept_redirects = 0
- net.ipv4.conf.default.accept_redirects = 0
- net.ipv6.conf.default.accept_redirects = 0
- # Ignore Directed pings
- net.ipv4.icmp_echo_ignore_all = 1
- Prévenir IP Spoofing
- sudo sysctl -p
Ajouter ou modifier (ne pas supprimer !) pour avoir les lignes suivantes :
- sudo nano /etc/host.conf
- Harden PHP pour la sécurité (si vous avez installé PHP)
- order bind,hosts
- multi on
- nospoof on
Ajouter ou modifier (ne pas supprimer !) pour avoir les lignes suivantes :
- sudo nano /etc/php5/apache2/php.ini
- disable_functions = exec,system,shell_exec,passthru
- register_globals = Off
- expose_php = Off
- magic_quotes_gpc = On
- sudo apt -y install screenfetch
- sudo apt -y install toilet
- sudo apt -y install figlet
-> Uploadez "clean.sh" et "now.sh" (in /home/Files/) et effectué "chmod +x clean.sh now.sh" pour lui donner le droit d'exécution pour pouvoir l'utiliser
-> Uploadez ".profile" (in /home/Files/) pour lui donner le droit d'exécution pour pouvoir l'utiliser
Mettre à jour le fichier "/home/now.sh"Mettre à jour le fichier "~/.bashrc"
- curl wttr.in/__YOUR_CITY__?0 --silent --max-time 3
Forcer à le recharger avec :
- source /home/Files/.profile
- source ~/.bashrc
- Securité
- apt-get install -y apache2 apache2-utils
- Modules
- ServerTokens Prod
- ServerSignature Off
Forcer à le recharger avec :
- sudo rewrite
- Configuration
- service apache2 restart
- Index
- <Directory /home/canan>
- Options -Indexes
- AllowOverride All
- Require all granted
- </Directory>
- sudo apt-get install -y php libapache2-mod-php php-gd
-> Si vous voulez le tester, créez simplement un fichier de test, puis continuez et finalement supprimez-le.
Mettre à jour le fichier "/var/www/html/test.php" (changer par le vôtre)Forcer à le recharger avec :
- <?php
- phpinfo();
- ?>
Allez sur http://__VOTRE_IP__/test.php
- service apache2 restart
Ajouter ou modifier (ne pas supprimer !) pour avoir les lignes suivantes :
- crontab -e
- 10 5 * * MON apt-get -y autoclean; apt-get -y autoremove; apt-get -y clean;
- 20 5 * * MON dpkg --purge $(COLUMNS=200 dpkg -l | grep "^rc" | tr -s ' ' | cut -d ' ' -f 2);
- 30 5 * * MON rm -fr /var/log/syslog.*; rm -fr /var/log/auth.log.*;
- 40 5 * * MON apt-get -y update; apt-get -y upgrade;